<template>
  <div class="recommend-box">
    <h4 class="recommend-title">
      <span class="left-line"></span>
      <span class="title">为你推荐</span>
    </h4>
    <div class="recommend-list flex content-box" style="cursor: pointer">
      <div class="recommend-item"  v-for="(product, productIndex) in list" :key="productIndex" @click="toDetail(product)">
        <img class="car-img" :src="product.pic|nopic" alt="" />
        <h4 class="car-name">{{product.name}}</h4>
        <p class="car-des">{{product.autoName}}</p>
        <p class="car-price">定向金 ￥<span class="price">{{product.price==null?'0.00':product.price}}</span></p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['list'],
  data() {
    return {
        // productList: this.list
    };
  },
  computed:{
      changeRemarkLength(){
          return function (text) {
              window.debugger;
              if(text==null){
                  text = 0.00;
              }
          }
      },
  },
  methods:{
      toDetail(product){
          this.$router.push({path:'/ProductDetail',query: product})
      }
  },
};
</script>


<style lang="scss" scoped>
.recommend-box {
    margin: 40px 0;
  .recommend-title {
    width: 1190px;
    margin: 0 auto 26px;
    text-align: left;
    // height: 24px;
    // line-height: 24px;
    color: #333233;

    .title {
      display: inline-block;
      vertical-align: middle;
    }
    .left-line {
      margin-right: 10px;
      display: inline-block;
      width: 6px;
      height: 22px;
      line-height: 24px;
      background-color: #fd686c;
      vertical-align: middle;
    }
  }
  .recommend-list {
    .recommend-item {
      width: 288px;
      height: 335px;
      background: #fff;
      margin-left: 13px;
      overflow: hidden;
      text-align: center;
      .car-img {
        //height: 238px;
        width: 100%;
      }
      .car-name {
        font-size: 18px;
        line-height: 18px;
        color: #2e2e2e;
        margin-top: 54px;
      }
      .car-des {
        font-size: 14px;
        line-height: 14px;
        color: #9e9e9e;
        margin-top: 8px;
      }
      .car-price {
        height: 16px;
        font-size: 14px;
        color: #cf2626;
           margin-top: 16px;
        .price {
          font-size: 20px;
          line-height: 20px;
        }
      }
    }
    .recommend-item:nth-child(1) {
      margin-left: 0;
    }
  }
}

/*手机端*/
@media (min-width: 320px) and (max-width: 800px) {
  .recommend-box {
    margin-top: 60px;

    .recommend-title {
      width: 100%;
    }
    .content-box {
      width: 100%;
      flex-wrap: wrap;
      justify-content: space-around;
      .recommend-item {
        width: 45%;
        height: 220px;
        margin-left: 0;
        margin-bottom: 10px;
        border-radius: 4px; 
      }
      .car-img {
        //height: 110px !important;
        width: 100%;
      }
      .car-name {
        margin-top: 20px !important;
        font-size: 16px !important;
        white-space: nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
        padding: 0 8px;
      }
      .car-des {
        white-space: nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
        padding: 0 8px;
      }
    }
   
  }
}
</style>